%%
clear
clc
mypic = imread('./pics/try4.pgm');
%display_1(mypic);

colormap(gray(256));

subplot(4,3,1), image(mypic);
daspect([1 1 1]);
axis off;

edge_map = edge(mypic);
subplot(4,3,2), image(edge_map*244);
daspect([1 1 1]);
axis off;

res = multi_partition(edge_map,0.6);
subplot(4,3,3), image(res*244);
daspect([1 1 1]);
axis off;

mypic = imread('./pics/tst1.pgm');

colormap(gray(246));

subplot(4,3,4), image(mypic);
daspect([1 1 1]);
axis off;

edge_map = edge(mypic);
subplot(4,3,5), image(edge_map*244);
daspect([1 1 1]);
axis off;

res = multi_partition(edge_map,0.6);
subplot(4,3,6), image(res*244);
daspect([1 1 1]);
axis off;

mypic = imread('./pics/tst2.pgm');

colormap(gray(246));

subplot(4,3,7), image(mypic);
daspect([1 1 1]);
axis off;

edge_map = edge(mypic);
subplot(4,3,8), image(edge_map*244);
daspect([1 1 1]);
axis off;

res = multi_partition(edge_map,0.6);
subplot(4,3,9), image(res*244);
daspect([1 1 1]);
axis off;

mypic = imread('./pics/tst4.pgm');

colormap(gray(246));

subplot(4,3,10), image(mypic);
daspect([1 1 1]);
axis off;

edge_map = edge(mypic);
subplot(4,3,11), image(edge_map*244);
daspect([1 1 1]);
axis off;

res = multi_partition(edge_map,0.6);
subplot(4,3,12), image(res*244);
daspect([1 1 1]);
axis off;

% mypic = rgb2gray(imread('./pics/tst4.jpg'));
% 
% colormap(gray(246));
% 
% subplot(4,3,13), image(mypic);
% daspect([1 1 1]);
% axis off;
% 
% edge_map = edge(mypic);
% subplot(4,3,14), image(edge_map*244);
% daspect([1 1 1]);
% axis off;
% 
% res = multi_partition(edge_map,0.6);
% subplot(4,3,14), image(res*244);
% daspect([1 1 1]);
% axis off;
